package cn.fsd.mapper;

import cn.fsd.domain.Commodity;
import cn.fsd.domain.CommodityClass;
import cn.fsd.query.delivery.CommodityClassQuery;
import cn.fsd.query.delivery.CommodityQuery;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface CommodityMapper {

  int deleteByPrimaryKey(String commodityId);

  int insert(Commodity record);

  Commodity selectByPrimaryKey(String commodity_id);

  List<Commodity> selectAll();

  int updateByPrimaryKey(Commodity record);

  List<Commodity> findByPage(CommodityQuery query);

  Commodity findCommodityByName(String commodityName);

  /**
   * 根据id批量获取商品
   * @param ids id列表
   * @return 商品列表
   */
  List<Commodity> findCommodityByPatch(List<String> ids);

  List<Commodity> getCommodityByClass(CommodityClassQuery query);

  /**
   * 根据商品名称模糊查询获得商品名称
   * @return 与名称匹配的商品列表
   */
  List<String> getCommodityIDsByName(String name);

  List<Commodity> selectByCode(String code);

  List<Commodity> getCommodityByClassId(@Param("classes") List<CommodityClass> classes,@Param("commodityName") String commodityName);

  List<Commodity> getCommodityByClassCommodityName(@Param("first_class") String firstClass,@Param("second_class") String secondClass,@Param("commodity_name") String commodityName);
}